package com.xiguaji.tiktok.v1.tiktok.mytiktok.repository;

import com.xiguaji.tiktok.v1.tiktok.mytiktok.model.TBloggerRecord;
import org.springframework.data.jdbc.repository.query.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface TBloggerRecordRepository extends CrudRepository<TBloggerRecord,Long>{



    @Query("SELECT * FROM t_blogger_record WHERE " +
            "uid = :uid AND record_date BETWEEN :startDate " +
            "AND :endDate AND FROM_UNIXTIME(record_date,'%H') % :hourInterval=0 " +
            "ORDER BY record_date")
    List<TBloggerRecord> findByUid(long uid, long startDate, long endDate, int hourInterval);


    @Query("SELECT MAX(update_time) FROM t_blogger")
    Long getLastUpdateTime();
}
